package bingfa;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * Created by Administrator on 2015/12/20.
 */
public class test_02 {
    public static void main(String[] args){
//        String str = "13636572175";
//        char[] chars =str.toCharArray();
//        for (int i = 3; i < 7; i++) {
//            chars[i] = '*';
//        }
//        System.out.println(String.valueOf(chars));

        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        java.util.Date date=new java.util.Date();
        String str=sdf.format(date);

        Calendar now = Calendar.getInstance();
        now.set(Calendar.DATE, now.get(Calendar.DATE) - 1);
        Date dayOff = now.getTime();
        System.out.println(sdf.format(now.getTime()));
        System.out.println(sdf.format(dayOff));

        now.set(Calendar.DATE, now.get(Calendar.DATE) - 7);
        System.out.println(sdf.format(now.getTime()));
        System.out.println(sdf.format(dayOff));

        now.set(Calendar.DATE, now.get(Calendar.DATE) - 30);
        System.out.println(sdf.format(now.getTime()));
        System.out.println(sdf.format(dayOff));

        now.set(Calendar.DATE, now.get(Calendar.DATE) - 45);
        System.out.println(sdf.format(now.getTime()));
        System.out.println(sdf.format(dayOff));

    }
}
